package com.yijianonghu.service.wxwebsite.lpcz;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yijianonghu.dal.model.SysBlog;
import com.yijianonghu.dal.model.SysBlogExample;

import net.javahub.dao.BaseSqlDao;
import net.javahub.dao.BaseSqlDao.SqlWrapper;
import net.javahub.service.BaseService;

@Service
public class LPCZProductListService extends BaseService<SysBlog, Integer, SysBlogExample>{
	
	@Autowired
	private BaseSqlDao baseSqlDao;
	
	public List<SysBlog> getLPCZProductListByLPCZTypeId(Integer lpczTypeId, String orderBy, Integer offset, Integer limit){
		StringBuilder sb=new StringBuilder("select * from sys_blog where topkeytype_typeid=#{lpczTypeId} and removeflag=0 ");
		sb.append(" and include_in_wx=#{include_in_wx}")
			.append(" order by "+orderBy)
			.append(" limit ")
			.append(offset)
			.append(", ")
			.append(limit);
		SqlWrapper wrapper=new SqlWrapper();
		wrapper.setSqlStatement(sb.toString());
		wrapper.addParam("include_in_wx", 1);
		wrapper.addParam("lpczTypeId", lpczTypeId);
		return baseSqlDao.selectList(wrapper, SysBlog.class);
	}
	
}
